﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Sharp.Portal;
using Sharp.Portal.AdminLTE;
using Sharp.Portal.Mvc;
using Sharp.Portal.Mvc.Form;
using Sharp.Portal.Mvc.Models;

namespace Sharp.WebBooter.Areas.Demo.Models
{
    public class ControlModel : ISharpForm
    {
        public ControlModel()
        {
            UI = new BSSharpFrom(this);
        }

        public SharpFrom UI { get; set; }

        /// <summary>
        /// 普通文本框
        /// </summary>
        [Display(Name = "普通文本框", Order = 0), DataType(DataType.Text),Required]
        public string Text { get; set; }

        /// <summary>
        /// 多行文本框
        /// </summary>
        [Display(Name = "多行文本框", Order = 5), DataType(DataType.MultilineText), Required]
        public string MultilineText { get; set; }

        /// <summary>
        /// 手机
        /// </summary>
        [Display(Name = "手机", Order = 0), DataType(DataType.PhoneNumber), Required]
        public string Phone { get; set; }

        /// <summary>
        /// 日期
        /// </summary>
        [Display(Name = "日期", Order = 2), DataType(DataType.Date), Required]
        [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
        public DateTime DateA { get; set; }

        /// <summary>
        /// 电子邮件
        /// </summary>
        [Display(Name = "电子邮件"), DataType(DataType.EmailAddress), Required]
        public string Email { get; set; }

        /// <summary>
        /// Html
        /// </summary>
        [Display(Name = "Html"), DataType(DataType.Html), Required]
        public string Html { get; set; }

        /// <summary>
        /// 货币
        /// </summary>
        [Display(Name = "货币"), DataType(DataType.Currency), Required]
        public string Currency { get; set; }


        /// <summary>
        /// ImageUrl
        /// </summary>
        [Display(Name = "图片"), DataType(DataType.ImageUrl), Required]
        public string ImageUrl { get; set; }

        /// <summary>
        /// ImageUrl
        /// </summary>
        [Display(Name = "图片上传"), DataType(DataType.Upload), Required]
        public string ImageUpload { get; set; }
        /// <summary>
        /// 布尔值选择框
        /// </summary>
        [Display(Name = "布尔值选择框"), Required]
        public bool BoolInput { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        [Display(Name = "性别"), MasterData("Gender"), Required]
        public string GenderCode { get; set; }


        [Display(Name = "归属部门", Order = 5), CustomField(FieldType.OrgTreeList, nameof(OrgIdDataSource)), Required]
        public Guid? OrgId { get; set; }
        /// <summary>
        /// 所属组织
        /// </summary>
        public zTreeNode OrgIdDataSource { get; set; }

        [Display(Name = "归属部门", Order = 6), CustomField(FieldType.DropDownList, "Title", "Id", nameof(DropDownListFieldDataSource)), Required]
        public string DropDownListField{ get; set; }

        public IEnumerable DropDownListFieldDataSource { get; set; }

        [Display(Name = "用户选取框"), CustomField(FieldType.SelectBox, "/Platform/User/UserDialog/", DisplayField = "", ValueField = nameof(UserId)), Required]
        public string UserName { get; set; }

        public string UserId { get; set; }

        [Display(Name = "员工选取框"), CustomField(FieldType.SelectBox, "/Platform/Employee/EmployeeDialog/", DisplayField = "", ValueField = nameof(EmployeeId)), Required]
        public string FullName { get; set; }

        public string EmployeeId { get; set; }
    }
}